#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <qevent.h>
#include "dwgobject.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

enum DrawType
{
    DNone,
    DLine,
    DCircle,
    DCircle2,
    DRectangle,
    DStar,
    DArc
};

enum ModifyType
{
    MNone,
    MSelect,
    MDelete
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    QVector<DwgObject *> mObjVec ;
    QPainter * mpainter = nullptr; // 保存绘图对象
    //QVector<DwgObject*>m_mainlist;
    DrawType mCurDrawType = DNone;
    ModifyType mCurModifyType = MNone;

    qreal m_winScale = 1.0;        // 记录 视图缩放比列 的变量
    QTransform m_trans;            // 记录 当前视图的变换矩阵 的变量

private slots:
    //void onActionlineTriggered();
private slots:
//    void onActioncircleTriggered();

//    void onActionrectangleTriggered();

//    void onActionstarTriggered();

//    void onActionnewTriggered();

//    void onActionopenTriggered();

//    void onActionsaveTriggered();

//    void onActionsaveasTriggered();

//    void onActionexitTriggered();

//    void circleTB_clicked();

    void lineTB_clicked();

    void rectTB_clicked();

    void starTB_clicked();

    void arcTB_clicked();

    void cirAct1_triggered();

    void cirAct2_triggered();

    void on_actionNew_triggered();

    void on_actionOpen_triggered();

    void on_actionSave_triggered();

    void on_actionSaveAs_triggered();

    void on_actionExit_triggered();

    void on_actionSelect_triggered();

    void on_actionDelete_triggered();

private:
    Ui::MainWindow *ui;

    // QWidget interface
protected:
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void paintEvent(QPaintEvent *event);

    // QWidget interface
protected:
    virtual void wheelEvent(QWheelEvent *event);

    // QWidget interface
protected:
    virtual void mouseMoveEvent(QMouseEvent *event);
};
#endif // MAINWINDOW_H
